package participle;

import java.io.StringReader;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.wltea.analyzer.lucene.IKAnalyzer;

public class Chinese {

	public static void main(String[] args) throws Exception {
		
		String s = "一个国家的文明程度，很重要的体现之一就在于她对弱势群体、障碍人士的入微体恤和人文关怀。";
		StringReader reader = new StringReader(s);
		Analyzer analyzer = new IKAnalyzer();
//		Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_33);
		TokenStream tokenStream = analyzer.tokenStream(null, reader);
		boolean hasnext = tokenStream.incrementToken();
		while(hasnext){
			
			TermAttribute att = tokenStream.getAttribute(TermAttribute.class);
			System.out.println(att.term());
			hasnext = tokenStream.incrementToken();
		}
	}
}
